package com.suixun.controller;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.suixun.controller.base.BaseController;
import com.suixun.service.BannerService;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author jacky
 * @since 2018-01-08
 */
@RestController
@RequestMapping("/banner")
public class BannerController extends BaseController {

	@Resource
	private BannerService bannerService;

	/**
	 * 功能描述: 查询banner列表
	 * 
	 * @param index
	 * @param range
	 * @return
	 */
	@RequestMapping("/listBanners/{range}")
	public Object listBanners(Integer index, @PathVariable("range") Integer range) {
		 return success(bannerService.listBanners(index, range));
	}

	/**
	 * 功能描述: 查询指定banner
	 * 
	 * @param index
	 * @param range
	 * @return
	 */
	@RequestMapping("/getBanner/{range}/{index}")
	public Object getBanner(@PathVariable("range") Integer range, @PathVariable("index") Integer index) {
		return success(bannerService.getBanner(index, range));
	}
}
